#include "ScreenCommService.hpp"
#include "stdio.h"
/* RTOS */
#include "FreeRTOS.h"
#include "task.h"
#include "semphr.h"
/* 接口库 */
#include "L2DataSet.hpp"
#include "DataAccessor.hpp"

static TaskHandle_t screen_comm_task;
static void ScreenComm_task( void * param){

    DataAccessor * data_accessor = DataAccessor::getInstance();
    while( true ){
        vTaskDelay(1000);
        printf("data:%f\r\n",data_accessor->getNumber("compressor.speedActual"));
        // if(xSemaphoreTake(compressor_speed_semaphore, portMAX_DELAY) == pdTRUE){
        //     if (xSemaphoreTake(compressor_speed_mutex, portMAX_DELAY) == pdTRUE) {
        //         printf("compressor_speed:%.2f\r\n",dataset.getNumber("compressor.speedActual"));
        //         xSemaphoreGive(compressor_speed_mutex);
        //     }
        // }
        printf("Screen\r\n");
    }
}


bool ScreenCommService::run(){

    xTaskCreate(ScreenComm_task,"ScreenComm_task",256,nullptr,1,&screen_comm_task);

    return true;
}